package com.yihen.controller;

import com.yihen.dto.RegistrationDto;
import com.yihen.dto.Result;
import com.yihen.service.RegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/registrations")
public class RegistrationController {
    @Autowired
    private RegistrationService registrationService;
    // 查询所有挂号信息
    @GetMapping("/get/all")
    public Result getAllRegistrationDto() {
        return registrationService.getAllRegistrationDto();
    }

    // 根据患者Id查询挂号信息
    @GetMapping("/get/patientid/{id}")
    public Result getRegistrationDtoByPatientId(@PathVariable long id) {
        return registrationService.getRegistrationDtoByPatientId(id);
    }

    // 根据医生Id查询挂号信息
    @GetMapping("/get/doctorid/{id}")
    public Result getRegistrationDtoByDoctorId(@PathVariable long id) {
        return registrationService.getRegistrationDtoByDoctorId(id);
    }

    // 根据Id查询挂号信息
    @GetMapping("/get/id/{id}")
    public Result getRegistrationDtoById(@PathVariable long id) {
        return registrationService.getRegistrationDtoById(id);
    }

    // 根据条件查询挂号信息
    @PostMapping("/get/condition")
    public Result getRegistrationDtoByCondition(@RequestBody RegistrationDto dto) {
        return registrationService.getRegistrationDtoByCondition(dto);
    }
}
